package com.headwind.logistics.operation.controller;

import com.headwind.logistics.common.util.LayuiUtil;

import com.headwind.logistics.common.pojo.FetchMoney;

import com.headwind.logistics.log.annotate.Log;
import com.headwind.logistics.operation.dto.FetchMoneyPaymentTransportUserDto;
import com.headwind.logistics.operation.pojo.WithdrawMoney;
import com.headwind.logistics.operation.service.inter.WithdrawMoneyBizInter;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author 周鑫
 * @Date 2020/7/16 16:46
 * @Version 1.0
 * @DESCRIPTION 控制器层
 */
@Controller
public class WithdrawMoneyController {

    @Resource
    WithdrawMoneyBizInter withdrawMoneyBizInter;


    @RequestMapping("/admin/operation/money")
    @ResponseBody
    @Log("查询所有和分页功能")
    public LayuiUtil selectAlltoCotroller( Integer page,  Integer limit){

        List<FetchMoneyPaymentTransportUserDto> fetchMoneyPaymentTransportUserDto = withdrawMoneyBizInter.queryWithdrawMoneyBizInter(page,limit);

        return LayuiUtil.data(withdrawMoneyBizInter.queryWithdrawMoneyBizInter(null,null).size(),fetchMoneyPaymentTransportUserDto);

    }



    @GetMapping("/admin/operation/update")
    @ResponseBody
    @Log("根据id修改余额提现审核表状态")
    public int updateWithdrawMoneyController(int checkMoneyId){

        return  withdrawMoneyBizInter.updateWithdrawMoneyBizInter(checkMoneyId);
    }


    @GetMapping("/admin/operation/updatetow")
    @ResponseBody
    @Log("根据id修改余额提现审核表状态")
    public int updateWithdrawMoneyTowController(int checkMoneyId){
        return withdrawMoneyBizInter.updateWithdrawMoneyBizInterTow(checkMoneyId);
    }


    @GetMapping("/admin/operation/updatetherr")
    @ResponseBody
    @Log("根据id修改余额提现审核表状态")
    public int updateWithdrawMoneyThreeController(int checkMoneyId){

        return  withdrawMoneyBizInter.updateWithdrawMoneyBizInterThree(checkMoneyId);
    }


    @GetMapping("/admin/operation/updatefour")
    @ResponseBody
    @Log("根据id修改余额提现审核表状态")
    public  int updateWithdrawMoneyFour(int checkMoneyId){
        return withdrawMoneyBizInter.updateWithdrawMoneyBizInterFour(checkMoneyId);
    }


    @GetMapping("/admin/operation/guigo.action")
    @ResponseBody
    @Log("根据id修改状态和原因")
    public int updateWithdrawMassageController(WithdrawMoney withdrawMoney){

        return withdrawMoneyBizInter.updateWithdrawMassageBizInter(withdrawMoney);
    }


    @GetMapping("/admin/operation/guigotow.action")
    @ResponseBody
    @Log("根据id修改状态和原因")
    public int updateWithdrawMassageTowController(WithdrawMoney withdrawMoney){

        return  withdrawMoneyBizInter.updateWithdrawMassageTowBizInter(withdrawMoney);
    }
    @GetMapping("/admin/operation/fetchprice")
    @ResponseBody
    @Log("根据id修改提现金额")
    public  int updateWithdrawFetchPriceController(Integer checkMoneyId,Double fetchPrice,Double money){
        System.out.println("chek======================"+checkMoneyId);
        System.out.println("fetch====================="+fetchPrice);
        System.out.println(money+"======================================");
        return  withdrawMoneyBizInter.updateWithdrawFetchPriceBizInter(checkMoneyId,fetchPrice,money);
    }
}
